#pragma once
#include "CNoParentShareableDependencyObject.h"


//typedef void (__stdcall *PFNRenderChangedHandler)(CDependencyObject *, DirtyFlags::Value);

class CMultiParentShareableDependencyObject :
	public CNoParentShareableDependencyObject
{

protected: 
	CMultiParentShareableDependencyObject(const CMultiParentShareableDependencyObject & original , HRESULT & hr);
	CMultiParentShareableDependencyObject(CCoreServices * pCore);
public: 
	CMultiParentShareableDependencyObject();
	virtual ~CMultiParentShareableDependencyObject();
	virtual HRESULT GetMentor(CDependencyObject * * ppMentor);
	virtual HRESULT GetParentCount(XUINT32 * puiCount);
	virtual HRESULT GetParentItem(CDependencyObject * * ppDO, XUINT32 uiIndex);
private: 
	void Initialize();
public: 
	virtual XBOOL DoesAllowMultipleParents();
	virtual HRESULT AddParent(CDependencyObject * pNewParent, XBOOL fPublic, PFNParentRenderChangedHandler  pfnNewParentRenderChangedHandler);
	virtual HRESULT RemoveParent(CDependencyObject * pParentToRemove);
	virtual HRESULT SetParentForInheritanceContextOnly(CDependencyObject * pDO);
	virtual XBOOL ShouldSharedObjectRegisterName(CResourceDictionary * pParentResourceDictionary);
	virtual HRESULT HasParent(CDependencyObject * pCandidate, XBOOL * pfCandidateIsParent);
	virtual struct Xcp_IDependencyObject * GetParent();
protected: 
	virtual void NWPropagateDirtyFlag(enum DirtyFlags::Value flags);
private: 
	virtual HRESULT UpdateParentParticipatesInManagedTree();

public:
	struct ParentAssociation
	{
		CDependencyObject * pParent;
		PFNParentRenderChangedHandler pfnRenderChangedHandler;
		ParentAssociation(const struct ParentAssociation & toCopy);
		ParentAssociation();
	};
private: 
	xvector<ParentAssociation> m_rgParentAssociation;

	struct MultiParentShareableDependencyObjectBitFields
	{
		XUINT32 fInheritanceContextEnabled:1;
	};

private: 
	struct MultiParentShareableDependencyObjectBitFields m_bitFields;
};

